#if APP_DRAWWAVE

#include "drawwave.h"
#include "ui_drawwave.h"

#if BOARD
#include "../function/logsys.h"
#endif

DrawWave::DrawWave(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::DrawWave)
{
    ui->setupUi(this);
    setWindowFlags(Qt::FramelessWindowHint);
    drawwavepaper=NULL;
    drawwavepaper=new DrawWavePaper(this);
    drawwavepaper->setGeometry(0,0,320,200);
    drawwavepaper->show();
}

DrawWave::~DrawWave()
{
    if(drawwavepaper)
        delete drawwavepaper;
    delete ui;
}

void DrawWave::readFileData(char *file)
{
    Log_Head head;
    Log_Data data;
    U64 i=0;
    printf("111\n");
    Api_Logsys_Init();
    if(Api_Logsys_ReadLog(file,&head)){
        drawwavepaper->setRange(0,100);
        printf("datacount=%lld\n",head.datacount);
        for(i=0;i<head.datacount;i++){
            if(Api_Logsys_ReadData(file,i,&data)){
                printf("i:%d,temper:%f\n",i,data.temper);
                drawwavepaper->Draw(data.temper);
            }
        }
    }
    Api_Logsys_Uninit();
    printf("2222\n");
}

#endif
